package com.kernel.streamDemo;

import com.kernel.entity.Person;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;

/****************************************
 * @name ObjectOutputStream
 * @description 对象序列化演示
 * @author 黄彬恒
 * @since 2018/8/21
 ***************************************/
public class ObjectOutputStreamDemo {
    public static void main(String[] args) throws IOException {
        File file = new File("D:\\ideaProgram\\IOLearning\\src\\main\\resources\\testDir\\person.txt");
        ObjectOutputStream oos;
        oos = new ObjectOutputStream(new FileOutputStream(file));
        oos.writeObject(new Person("张三", 23));
        oos.close();
    }
}
